package com.szrt.java.day20161227.demo04;

import java.util.Arrays;

public class ArrayDeleteTest01 {

	public static void main(String[] args) {
		
		int[] olds = new int[]{5,4,3,2,1};
		
		//1 找到3的下标是什么
		int index3 = 2;
		
		//2 创建1个新的数组  olds.length-1
		int length = olds.length;
		int[] news = new int[length-1];
		
		//遍历旧的数组
		
		//3.1 如果下标比index3小  原样复制
		for(int first =0;first<index3;first++){
			
			int value = olds[first];
			news[first] = value; 
			
		}
		
        for(int first =index3+1;first<length;first++){
			
			int value = olds[first];
			news[first-1] = value; 
			
		}
        System.out.println(Arrays.toString(news));
		
	}
	
}
